Public Class frmTOGOLIST

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub frmTOGOLIST_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        Try
            GC.Collect()
            Me.Dispose()
        Catch ex As Exception

        End Try
    End Sub

    Private Sub frmTOGOLIST_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        PublicFunction.NewFormLoad(Me)

        Me.GridRecall.RootTable.Columns("BILL_TOTAL").FormatString = PublicVariable.NumberFormatString
        Me.GridRecall.RootTable.Columns("BILL_DATE").FormatString = PublicVariable.DateTimeFormat
        GridRecall.DataSource = BLL.ObjectGetAll("TOGO_LOAD")
    End Sub

    Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If GridRecall.RowCount = 0 Then Return

        Dim BillCode As Integer = GridRecall.GetValue("BILL_CODE")
        If BillCode > 0 Then
            If SystemFunction.ShowYesNoForm("ARE YOU SURE YOU WANT TO CANCEL THIS BILL?", "") = Windows.Forms.DialogResult.Yes Then
                oOrder.BILL_CANCEL(BillCode)
                Me.Close()
            End If

        End If
    End Sub

    Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
        Dim frm As New frmORDER
        If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
            Dim arName As New ArrayList
            arName.Add("@BILL_CODE")
            Dim arVal As New ArrayList
            arVal.Add(frm.BillCode)
            BLL.Object_Update_NonResult("BILL_TOGO", arName, arVal)
            GridRecall.DataSource = BLL.ObjectGetAll("TOGO_LOAD")
        End If
    End Sub

    Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
        Dim frm As New frmORDER
        frm.BillCode = Me.GridRecall.GetValue("BILL_CODE")
        frm.ShowDialog()
    End Sub
End Class